home *** CD-ROM | disk | FTP | other *** search
/ Click Press Kit / Click Press Kit.iso / pc / main.dxr / Internal_7_More Code4.ls < prev    next >
Encoding:
Text File  |  2006-05-31  |  4.1 KB  |  138 lines

  1. global gMaster, gMasterDocPath, gMasterFolder
  2.  
  3. on CaptionCode vPathInfo
  4.   fileObj2 = new(xtra("fileIO"))
  5.   vTemp = gMasterDocPath & "Captions.txt"
  6.   vTemp2 = gMasterDocPath & "Captions.txt"
  7.   vOK = 0
  8.   if baFileExists(vTemp) = 1 then
  9.     vOK = 1
  10.   else
  11.     vOK = 0
  12.   end if
  13.   if vOK = 1 then
  14.     vMasterPath = gMasterFolder
  15.   else
  16.     if baFileExists(vTemp2) = 1 then
  17.       vOK = 2
  18.       vMasterPath = gMasterFolder
  19.     else
  20.       vOK = 0
  21.       vMasterPath = gMasterFolder
  22.     end if
  23.   end if
  24.   case vOK of
  25.     0:
  26.       saveText2(vTemp2, gMaster.pCaption1, gMaster.pCaption2, gMaster.pCaption3)
  27.     1, 2:
  28.       openfile(fileObj2, vTemp2, 0)
  29.       if status(fileObj2) <> 0 then
  30.         err = error(fileObj2, status(fileObj2))
  31.         alert("Error:" && err)
  32.         return EMPTY
  33.       end if
  34.       vText = readFile(fileObj2)
  35.       closeFile(fileObj2)
  36.       saveText1(vText, vTemp2, gMaster.pCaption3)
  37.   end case
  38. end
  39.  
  40. on saveText1 text, vFileName, vCaption3
  41.   Ok = baCreateFolder(gMasterDocPath)
  42.   vNewname = vFileName
  43.   fileObj = new(xtra("FileIO"))
  44.   if the platform contains "mac" then
  45.     setFilterMask(fileObj, "TEXT")
  46.   else
  47.     setFilterMask(fileObj, "Text Files,*.txt,All Files,*.*")
  48.   end if
  49.   if vFileName = EMPTY then
  50.     return 0
  51.   end if
  52.   openfile(fileObj, vNewname, 2)
  53.   delete(fileObj)
  54.   createFile(fileObj, vNewname)
  55.   openfile(fileObj, vNewname, 2)
  56.   if status(fileObj) <> 0 then
  57.     err = error(fileObj, status(fileObj))
  58.     alert("Error:" && err)
  59.     return 0
  60.   end if
  61.   vPhotoCaptions = CollectPhotoCaptions()
  62.   vLines = "==================================================="
  63.   if the platform contains "Mac" then
  64.     vAdditionText = text & RETURN & RETURN & RETURN & RETURN & vLines & RETURN & RETURN & vPhotoCaptions & RETURN & RETURN & vCaption3
  65.   else
  66.     CRLF = RETURN & numToChar(10)
  67.     vAdditionText = text & CRLF & CRLF & CRLF & CRLF & vLines & CRLF & CRLF & vPhotoCaptions & CRLF & CRLF & vCaption3
  68.   end if
  69.   writeString(fileObj, vAdditionText)
  70.   if the platform contains "Mac" then
  71.     setFinderInfo(fileObj, "TEXT ttxt")
  72.   end if
  73.   closeFile(fileObj)
  74.   return 1
  75. end
  76.  
  77. on saveText2 vFileName, vCaption1, vCaption2, vCaption3
  78.   Ok = baCreateFolder(gMasterDocPath)
  79.   vNewname = vFileName
  80.   fileObj = new(xtra("FileIO"))
  81.   if the platform contains "mac" then
  82.     setFilterMask(fileObj, "TEXT")
  83.   else
  84.     setFilterMask(fileObj, "Text Files,*.txt,All Files,*.*")
  85.   end if
  86.   if vFileName = EMPTY then
  87.     return 0
  88.   end if
  89.   openfile(fileObj, vNewname, 2)
  90.   delete(fileObj)
  91.   createFile(fileObj, vNewname)
  92.   openfile(fileObj, vNewname, 2)
  93.   if status(fileObj) <> 0 then
  94.     err = error(fileObj, status(fileObj))
  95.     alert("Error:" && err)
  96.     return 0
  97.   end if
  98.   vPhotoCaptions = CollectPhotoCaptions()
  99.   if the platform contains "Mac" then
  100.     vText = vCaption1 & RETURN & RETURN & vCaption2 & RETURN & vPhotoCaptions & RETURN & RETURN & vCaption3
  101.   else
  102.     CRLF = RETURN & numToChar(10)
  103.     vText = vCaption1 & CRLF & CRLF & vCaption2 & CRLF & vPhotoCaptions & CRLF & CRLF & vCaption3
  104.   end if
  105.   writeString(fileObj, vText)
  106.   if the platform contains "Mac" then
  107.     setFinderInfo(fileObj, "TEXT ttxt")
  108.   end if
  109.   closeFile(fileObj)
  110.   return 1
  111. end
  112.  
  113. on CollectPhotoCaptions
  114.   vTempText = EMPTY
  115.   repeat with y = 1 to gMaster.pPhotoList.count
  116.     if gMaster.pPhotoList[y].pSelected = "yes" then
  117.       if gMaster.pLanguageMode = "english" then
  118.         vlargeName = gMaster.pPhotoList[y].pLargeName & " - "
  119.         if the platform contains "Mac" then
  120.           vTempText = vTempText & RETURN & RETURN & vlargeName & gMaster.pPhotoList[y].pEnglishCaption
  121.         else
  122.           CRLF = RETURN & numToChar(10)
  123.           vTempText = vTempText & CRLF & CRLF & vlargeName & gMaster.pPhotoList[y].pEnglishCaption
  124.         end if
  125.         next repeat
  126.       end if
  127.       vlargeName = gMaster.pPhotoList[y].pLargeName & " - "
  128.       if the platform contains "Mac" then
  129.         vTempText = vTempText & RETURN & RETURN & vlargeName & gMaster.pPhotoList[y].pSpanishCaption
  130.         next repeat
  131.       end if
  132.       CRLF = RETURN & numToChar(10)
  133.       vTempText = vTempText & CRLF & CRLF & vlargeName & gMaster.pPhotoList[y].pSpanishCaption
  134.     end if
  135.   end repeat
  136.   return vTempText
  137. end
  138.